package com.web.selenium;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedCondition;

public class WebElementWait implements ExpectedCondition<Boolean>{

	private WebElement element;
	
	private By by;
	
	public WebElementWait(By by){
		
		this.by = by;
	}
	
	public Boolean apply(WebDriver driver) {
			
		try{
			element = driver.findElement(by);
			
			return true;
		}
		catch(Exception e){
		
			return false;
		}	
	}
	
	public WebElement getWebElement(){
		
		return element;
	}
}
